package com.sztx.pay.center.worker;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import com.sztx.pay.center.common.util.Constance;
import com.sztx.pay.center.core.service.DumpDataHandleService;
import com.sztx.pay.center.dataaccess.domain.OrderB2cDumpDO;
import com.sztx.se.common.domain.Result;
import com.sztx.se.common.domain.ResultCode;
import com.sztx.se.core.quartz.component.QuartzManager;
import com.sztx.se.core.tbschedule.component.ScheduleManager;
import com.sztx.se.unit.test.BaseUnTransactionalTest;

public class WorkerTester extends BaseUnTransactionalTest {

	@Autowired(required = false)
	private QuartzManager quartzManager;

	@Autowired(required = false)
	private ScheduleManager scheduleManager;

	@Autowired
	private DumpDataHandleService dumpDataHandleService;
	
	
	/**
	 * 未处理
	 */
	public static final Integer STATUS_UNPROCESS = 0;

	/**
	 * 处理中
	 */
	public static final Integer STATUS_PROCESSING = 1;

	/**
	 * 已处理失败
	 */
	public static final Integer STATUS_PROCESSED_FAILED = 2;

	/**
	 * 已处理成功
	 */
	public static final Integer STATUS_PROCESSED_SUCCESS = 3;
	
	@Before
	public void setUp() throws Exception {

	}

	@After
	public void tearDown() throws Exception {

	}

	@SuppressWarnings("unused")
	@Test
	public void testQuartz() {
		String schedName = "tradeCenterScheduler";
		String jobName = "扫描定时结算订单任务";
		String jobGroup = "结算订单任务组";
		String jobClassName = "scanSettleLaterOrderJob";
		String description = "扫描未结算的定时结算订单并进行结算";
		boolean isRecovery = false;
		String triggerName = "每10分钟执行的结算扫描";
		String triggerGroup = "结算扫描触发器组";
		boolean isCronTrigger = true;
		String expression = "0 */5 * * * ?";
		Map<String, String> extraInfo = new HashMap<String, String>();
		extraInfo.put("extra", "trade_center_settle");
		quartzManager.saveOrUpdateJob(schedName, jobName, jobGroup, jobClassName, description, isRecovery, triggerName, triggerGroup, isCronTrigger,
				expression, null, null, extraInfo);
		// 返回页面
		Result result = new Result(ResultCode.COMMON_SUCCESS, true);
	}
}